<?php
include_once('baseModel.php');


class Ticket extends BaseModel {
  public $_table="ticket";
  
  public $id;
  public $identifier;
  
  function loadByIdentifier($id) {
    $query = "SELECT * FROM " . $this->_table . " WHERE identifier = " . $id;
    $results = DBHelper::executeQuery($query);
    if(!$results) {
      return;
    }
    // there might be more than one results
    $tickets = array();
    
    foreach($results as $result) {
      $this->populateModel($result);
      array_push($tickets, clone $this);
    }
    return $tickets;
  }
}


?>
